
	function trim(str)
	{
		return str.replace(/(^[ \f\n\r\t]*)|([ \f\n\r\t]*$)/g, "");
	}

	function countChar(str, ch)
	{
		if (str == null) return 0;

		var nCount = 0;
		for (var i = 0; i < str.length; i++)
		{
			var chTemp = str.substring(i, i+1);
			if (chTemp == ch) nCount++;
		}

		return nCount;
	}

	function countLF(str) { return countChar(str, "\n"); }

	function getLength(str)
	{
		if (str == "") return 0;
		return (str.length + (escape(str) + '%u').match(/%u/g).length - 1);
	}

	function getByteLength(str)
	{
		if (str == "") return 0;
		return getLength(str) - countLF(str);
	}

	function checkField(field)
	{
		if (field == null)
			return false;

		if (trim(field) == '')
			return false;

		return true;
	}

	function strReplaceAll(str, x, y)
	{
		var dest = "";
		var c;
		for (var i = 0; i < str.length; i++)
		{
			if (str.substring(i, i + 1) == x)
				c = y;
			else
				c = str.substring(i,i + 1);
			dest = dest + c;
		}

		return dest;
	}

	function containsCharOnly(charV, chars)
	{
		if (chars.indexOf(charV) == -1)
			return false;

		return true;
	}

	function isAlphaNumAddChars(charV, AddChars)
	{
    	var uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    	var lowercase = "abcdefghijklmnopqrstuvwxyz"; 
    	var number    = "0123456789";
    	// var AddChars = "./:"; 
    	var chars = uppercase + lowercase + number + AddChars;

    	return containsCharOnly(charV, chars);
	}

	function checkOnlyNumber(str)
	{
	    var src = new String(str);
	    var len = src.length;
	    for (var i = 0; i < len; i++)
	    {
	        if ((src.charAt(i) < '0') | (src.charAt(i) > '9'))
	            return false;
	    }

	    return true;
	}

	function onlyNumAndAlphabetAddChars(obj, AddChars)
	{
		if(checkOnlyNumber(obj.value))
			return;
		else
		{
			var str = new String(obj.value);
			for(var i = 0; i < str.length; i++)
			{
				if(!isAlphaNumAddChars(str.charAt(i), AddChars))
					obj.value = strReplaceAll(obj.value, str.charAt(i), "");
			}

			return;
		}
		obj.focus();
	}

	function isEmail(str)
	{
		invalidChars = ' #$%^&*()=+/:,;';
		for (var i = 0; i < invalidChars.length; i++)
		{
			badChar = invalidChars.charAt(i);
			if (str.indexOf(badChar, 0) > -1)
				return false;
		}
		atPos = str.indexOf('@', 1);
		if (atPos == -1)
			return false;
		if (str.indexOf('@', atPos + 1) > -1)
			return false;
		periodPos = str.indexOf('.', atPos);
		if (periodPos == -1)
			return false;
		if (periodPos + 3 > str.length)
			return false;

		return true;
	}

	function isIpPort(ip)
	{
		var ipPattern = /^(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3}):(\d{1,5})$/;
		var ipArray = ip.match(ipPattern);

		if (ipArray == null)
			return false;

		for (i = 0; i < 4; i++)
		{
			ipSegment = ipArray[i];
			if (ipSegment > 255)
				return false;
		}

		portSegment = ipArray[4];
		if (portSegment > 65526)
			return false;

		return true;
	}

	function getTodayDate()
	{
		var today = new Date();
		var yearNow = today.getYear();
		var monthNow = today.getMonth() + 1;
		var dateNow = today.getDate();
		var todayNow = '';
		if (monthNow < 10)
			todayNow = yearNow + '/' + '0' + monthNow;
		else
			todayNow = yearNow + '/' + monthNow;
		if (dateNow < 10)
			todayNow = todayNow + '/' + '0' + dateNow;
		else
			todayNow = todayNow + '/' + dateNow;

		return todayNow;
	}

	
	/*20091007*/
	//근태확인 - 성명조회 공백. 
	function fnc_clearName() {
		document.frm.searchEmpNm.value = "";
	}